const App = getApp();
import siteinfo from '../../../siteinfo.js';
const apiroot = siteinfo.siteroot + 'index.php?s=/api/';
Page({

  /**
   * 页面的初始数据
   */
  data: {
    isData: false,
    words: {},
    user: {},
    dealer: {},
    man:false,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    var that=this
    wx.request({
      url: apiroot + 'manba/dechect', //仅为示例，并非真实的接口地址
      data: {
        
        user_id: wx.getStorageSync('user_id'),
      },

      success(res) {
        console.log(res.data)
        if (res.data.code == 200) {
          that.setData({
            bao: false,
            man: true
          })
        }
      }
    })
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    let _this = this;
    // 获取分销商中心数据
    _this.getDealerCenter();
  },

  /**
   * 获取分销商中心数据
   */
  getDealerCenter() {
    let _this = this;
    App._get('user.dealer/center', {}, function(result) {
      let data = result.data;
      data.isData = true;
      // 设置当前页面标题
      wx.setNavigationBarTitle({
        title: data.words.index.title.value
      });
      _this.setData(data);
    });
  },

  /**
   * 跳转到提现页面
   */
  navigationToWithdraw() {
    wx.navigateTo({
      url: '../withdraw/apply/apply',
    })
  },

  /**
   * 立即加入分销商
   */
  triggerApply(e) {
    wx.navigateTo({
      url: '../apply/apply',
    })
  },

})